package com.alumni_circle.mapper.me;

import com.alumni_circle.entity.me.Authentication;
import com.alumni_circle.entity.me.VO.AuthenticationViewVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

public interface AuthenticationMapper extends BaseMapper<Authentication> {

    @Select("SELECT user.username,user.name,authentification.create_time,authentification.club,authentification.state,authentification.id,authentification.user_id\n" +
            "FROM user,authentification\n" +
            "WHERE authentification.user_id = user.id")
    List<AuthenticationViewVO> getAll();

    @Select("SELECT user.username,user.name,authentification.create_time,authentification.club,authentification.state,authentification.id,authentification.user_id\n" +
            "FROM user,authentification\n" +
            "WHERE authentification.user_id = user.id\n" +
            "AND user.username LIKE concat('%',#{username},'%') AND authentification.club LIKE concat('%',#{club},'%')")
    List<AuthenticationViewVO> search(@Param("username")String username,@Param("club")String club);
}
